package learnjava.basic.other;

public class TestDuoTai {
    public static void main(String[] args) {
        Fu fu = new Zi(5);
        Zi zi = new Zi(5);
        fu.method();
        fu.staticMethod();
        zi.method();                //一般方法看实际类型
        zi.staticMethod();          //静态方法只看左边
        System.out.println(fu.j); //成员变量只看左边
        System.out.println(zi.j);
    }
}

class Fu{
    public int i = 8;
    public int j = 8;
    public Fu(){};
//    public Fu(int num){
//        j = num;
//    }
    public void method(){
        System.out.println("method of Fu");
    }
    public static void staticMethod(){
        System.out.println("father static");
    }
}

class Zi extends Fu{
    public int i = 5;
    public int j;
    public Zi(int num){
        j = num;
    }
    @Override
    public void method() {
        System.out.println("method of Zi");
    }
    public static void staticMethod(){
        System.out.println("son static");
    }
}
